home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 January / PC-WELT 01-2001.ISO / software / linux / office / f_0116 / soffice
Encoding:
Text File  |  2000-09-18  |  6.0 KB  |  231 lines

  1. #!/bin/sh
  2. #*************************************************************************
  3. #
  4. #   $RCSfile: soffice.sh,v $
  5. #
  6. #   $Revision: 1.1.1.1 $
  7. #
  8. #   last change: $Author: hr $ $Date: 2000/09/18 16:15:12 $
  9. #
  10. #   The Contents of this file are made available subject to the terms of
  11. #   either of the following licenses
  12. #
  13. #          - GNU Lesser General Public License Version 2.1
  14. #          - Sun Industry Standards Source License Version 1.1
  15. #
  16. #   Sun Microsystems Inc., October, 2000
  17. #
  18. #   GNU Lesser General Public License Version 2.1
  19. #   =============================================
  20. #   Copyright 2000 by Sun Microsystems, Inc.
  21. #   901 San Antonio Road, Palo Alto, CA 94303, USA
  22. #
  23. #   This library is free software; you can redistribute it and/or
  24. #   modify it under the terms of the GNU Lesser General Public
  25. #   License version 2.1, as published by the Free Software Foundation.
  26. #
  27. #   This library is distributed in the hope that it will be useful,
  28. #   but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30. #   Lesser General Public License for more details.
  31. #
  32. #   You should have received a copy of the GNU Lesser General Public
  33. #   License along with this library; if not, write to the Free Software
  34. #   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35. #   MA  02111-1307  USA
  36. #
  37. #
  38. #   Sun Industry Standards Source License Version 1.1
  39. #   =================================================
  40. #   The contents of this file are subject to the Sun Industry Standards
  41. #   Source License Version 1.1 (the "License"); You may not use this file
  42. #   except in compliance with the License. You may obtain a copy of the
  43. #   License at http://www.openoffice.org/license.html.
  44. #
  45. #   Software provided under this License is provided on an "AS IS" basis,
  46. #   WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  47. #   WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  48. #   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  49. #   See the License for the specific provisions governing your rights and
  50. #   obligations concerning the Software.
  51. #
  52. #   The Initial Developer of the Original Code is: Sun Microsystems, Inc..
  53. #
  54. #   Copyright: 2000 by Sun Microsystems, Inc.
  55. #
  56. #   All Rights Reserved.
  57. #
  58. #   Contributor(s): _______________________________________
  59. #
  60. #
  61. #
  62. #*************************************************************************
  63.  
  64. #
  65. # STAR_PROFILE_LOCKING_DISABLED=1
  66. # export STAR_PROFILE_LOCKING_DISABLED
  67. #
  68.  
  69. # uncomment this to remote start soffice on hostname  
  70. # SO_REMOTE_START=rsh
  71. # SO_REMOTE_APPLICATION=hostname:/fully_quallified_path/soffice
  72.  
  73. # set -x
  74.  
  75. # resolve installation directory
  76. sd_platform=`uname -s`
  77. case $sd_platform in
  78.     SCO_SV) test=/bin/test     ;;
  79.       *)      test=/usr/bin/test ;;
  80. esac
  81.  
  82. sd_cwd="`pwd`"
  83. if $test -L "$0" ; then
  84.     sd_basename=`basename $0`
  85.      sd_script=`ls -l $0 | sed "s/.*${sd_basename} -> //g"` 
  86. else
  87.     sd_script="$0"
  88. fi
  89.  
  90. cd "`dirname "$sd_script"`/.."
  91. sd_binary=`basename "$sd_script"`".bin"
  92. sd_inst="`pwd`"
  93.  
  94. # change back directory
  95. cd "$sd_cwd"
  96.  
  97. sd_fonts="$sd_inst/share/fonts"
  98.  
  99. # check if all required patches are installed
  100. if [ -x "$sd_inst/program/sopatchlevel.sh" ]; then
  101.     "$sd_inst/program/sopatchlevel.sh"
  102.     if [ $? -eq 1 ]; then
  103.         exit 0
  104.     fi
  105. fi
  106.  
  107. # extend the ld_library_path for java: javaldx checks the sofficerc for us
  108. java_ld_library_path=`"$sd_inst/program/javaldx" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"`
  109. if [ "$java_ld_library_path" != "" ] ; then
  110.     LD_LIBRARY_PATH=${java_ld_library_path}:${LD_LIBRARY_PATH}
  111. fi
  112.  
  113. # set java environment variables
  114. THREADS_TYPE=native_threads
  115.  
  116. # set search path for shared libraries
  117. case $sd_platform in
  118.   SunOS)
  119.     LD_LIBRARY_PATH="$sd_inst/program":/usr/openwin/lib:/usr/dt/lib:$LD_LIBRARY_PATH
  120.     export LD_LIBRARY_PATH
  121.     ;;
  122.  
  123.   AIX)
  124.     LIBPATH="$sd_inst/program":$LIBPATH
  125.     export LIBPATH
  126.     ;;
  127.  
  128.   HP-UX)
  129.     SHLIB_PATH="$sd_inst/program":/usr/openwin/lib:$SHLIB_PATH
  130.     export SHLIB_PATH
  131.     ;;
  132.  
  133.   IRIX)
  134.     LD_LIBRARYN32_PATH=:"$sd_inst/program":$LD_LIBRARYN32_PATH
  135.     export LD_LIBRARYN32_PATH
  136.     ;;
  137.  
  138.   Linux)
  139.     LD_LIBRARY_PATH="$sd_inst/program":$LD_LIBRARY_PATH
  140.     export LD_LIBRARY_PATH
  141.     ;;
  142.  
  143.   *)
  144.     LD_LIBRARY_PATH="$sd_inst/program":$LD_LIBRARY_PATH
  145.     export LD_LIBRARY_PATH
  146.     ;;
  147. esac
  148.  
  149. # misc. environment variables
  150. SAL_FONTPATH="$sd_fonts/75dpi:unscaled;$sd_fonts/type1;$sd_fonts/75dpi"
  151. XPPATH="$sd_inst/share/xp3"
  152.  
  153. unset XENVIRONMENT
  154.  
  155. export SAL_FONTPATH XPPATH
  156.  
  157. # error message function
  158. err () {
  159.     echo "`basename $0`: $@" 1>&2
  160.     exit 1
  161. }
  162.  
  163. #
  164. # parse command line arguments
  165. #
  166.  
  167. for DUMMY in ${1+"$@"}
  168. do
  169.     case $1 in
  170.  
  171.     ?display) 
  172.         if [ $# -lt 2 ]; then
  173.             err "$1 option requires a display name"
  174.         fi
  175.         DISPLAY=$2
  176.         export DISPLAY
  177.         shift; shift
  178.         ;;
  179.     ?rsh)
  180.         SO_REMOTE_START="rsh";
  181.         shift
  182.         ;;
  183.     ?norsh)
  184.         SO_REMOTE_START="norsh";
  185.         shift
  186.         ;;
  187.     ?server)
  188.         # set the application server 
  189.         if [ $# -lt 2 ]; then
  190.             err "$1 option requires hostname:/path_to_executable as argument"
  191.         fi
  192.         # dont overrule external settings
  193.         if [ "X${SO_REMOTE_APPLICATION}" = "X" ]; then
  194.             SO_REMOTE_APPLICATION=$2;
  195.         fi
  196.         shift; shift
  197.         ;;
  198.     *)
  199.         break;
  200.         ;;
  201.     esac
  202. done
  203.  
  204. # start soffice by remote shell
  205. if [ "X${SO_REMOTE_START}" = "Xrsh" ]; then
  206.     remote_server=`echo ${SO_REMOTE_APPLICATION} | sed 's/:.*//g'`
  207.     remote_path=`echo ${SO_REMOTE_APPLICATION} | sed 's/.*://g'`
  208.     echo remote_server=\"${remote_server}\" remote_path=\"${remote_path}\"
  209.     if [ "X${DISPLAY}" = "X" ]; then
  210.         local_display=`uname -n`:0
  211.     else
  212.         local_display=${DISPLAY}
  213.     fi
  214.  
  215.     if [ "X${remote_server}" != "X" -a "X${remote_path}" != "X" ]; then
  216.         rsh ${remote_server} ${remote_path} -norsh -display ${local_display}
  217.         exit 0
  218.     else
  219.         err "invalid rsh arguments host=\"$remote_server\", command=\"${remote_path}\""
  220.     fi
  221. fi
  222.  
  223. # set path so that other apps can be started from soffice just by name
  224. PATH="$sd_inst/program":$PATH
  225. export PATH
  226.  
  227. # execute soffice binary
  228. # there is a bug in solaris sh that prevents the use of "$@"
  229. # because it cannot cope with spaces in directory names
  230. exec "$sd_inst/program/$sd_binary" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
  231.